home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / Pascal / Applications / NIH Image 1.62b11 / src / Globals.p < prev    next >
Text File  |  1997-05-06  |  42KB  |  1,248 lines

  1. unit Globals;
  2.  
  3. {Global declarations for NIH Image program.}
  4.  
  5.  
  6. interface
  7.  
  8.  
  9. uses
  10.         Types, QuickDraw, Controls, Menus, Dialogs, TextEdit, Palettes, Printing, Files, Components, QDOffscreen;
  11.  
  12. const
  13.         Version = 162;
  14.  
  15.         UsingFPU = false; {If true, select 68881/68882 in Compile Options dialog box.}
  16.  
  17.         AppleMenu = 128;
  18.  
  19.         FileMenu = 129;
  20.         NewItem = 1;
  21.         OpenItem = 2;
  22.         ImportItem = 3;
  23.         CloseItem = 5;
  24.         SaveItem = 6;
  25.         SaveAsItem = 7;
  26.         ExportItem = 8;
  27.         RecordPreferencesItem = 10;
  28.         RevertItem = 11;
  29.         DuplicateItem = 12;
  30.         GetInfoItem = 13;
  31.         AcquireItem = 15;
  32.         PlugInExportItem = 16;
  33.         PageSetupItem = 18;
  34.         PrintItem = 19;
  35.         QuitItem = 21;
  36.  
  37.         AcquireMenu = 42; {Sub Menu}
  38.  
  39.         ExportMenu = 44; {Sub Menu}
  40.  
  41.         EditMenu = 130;
  42.         UndoItem = 1;
  43.         CutItem = 3;
  44.         CopyItem = 4;
  45.         PasteItem = 5;
  46.         ClearItem = 6;
  47.         FillItem = 8;
  48.         InvertItem = 9;
  49.         DrawBoundaryItem = 10;
  50.         DrawScaleItem = 11;
  51.         SelectAllItem = 13;
  52.         DeselectItem = 14;
  53.         ScaleAndRotateItem = 15;
  54.         RotateLeftItem = 17;
  55.         RotateRightItem = 18;
  56.         FlipVerticalItem = 19;
  57.         FlipHorizontalItem = 20;
  58.         UnzoomItem = 22;
  59.         ShowClipboardItem = 23;
  60.  
  61.         OptionsMenu = 131;
  62.         GrayscaleItem = 1;
  63.         ColorTablesItem = 2;
  64.         LutOptionsItem = 3;
  65.         PreferencesItem = 9;
  66.         PlotOptionsItem = 10;
  67.         ScaleToFitItem = 11;
  68.         ThresholdItem = 12;
  69.         SliceItem = 13;
  70.         PropagateItem = 14;
  71.  
  72.         FontMenu = 32; {Sub Menu}
  73.  
  74.         SizeMenu = 33; {Sub Menu}
  75.  
  76.         StyleMenu = 34; {Sub Menu}
  77.         LeftItem = 8;
  78.         CenterItem = 9;
  79.         RightItem = 10;
  80.         NoBackgroundItem = 12;
  81.         WithBackgroundItem = 13;
  82.  
  83.         ColorTablesMenu = 41; {Sub Menu}
  84.         SystemPaletteItem = 1;
  85.         Pseudo20Item = 2;
  86.         Pseudo32Item = 3;
  87.         RainbowItem = 4;
  88.         Fire1Item = 5;
  89.         Fire2Item = 6;
  90.         IceItem = 7;
  91.         GraysItem = 8;
  92.         SpectrumItem = 9;
  93.  
  94.         PropagateMenu = 38;   {Sub Menu}
  95.         LUTItem = 1;
  96.         SpatialItem = 2;
  97.         DensityItem = 3;
  98.         AllItem = 4;
  99.  
  100.         ProcessMenu = 132;
  101.         SmoothItem = 1;
  102.         SharpenItem = 2;
  103.         ShadowItem = 3;
  104.         FindEdgesItem = 4;
  105.         RankItem = 5;
  106.         DitherItem = 6;
  107.         ConvolveItem = 7;
  108.         FilterItem = 8;
  109.         BinaryItem = 10;
  110.         ConstMathItem = 11;
  111.         ImageMathItem = 12;
  112.         fftItem =13;
  113.         BackgroundItem = 14;
  114.         ApplyItem = 15;
  115.         EnhanceItem = 16;
  116.         EqualizeItem = 17;
  117.         FixColorsItem = 18;
  118.  
  119.         FilterMenu = 43; {Sub Menu}
  120.  
  121.         BinaryMenu = 35; {Sub Menu}
  122.         MakeBinaryItem = 1;
  123.         ErosionItem = 3;
  124.         DilationItem = 4;
  125.         OpeningItem = 5;
  126.         ClosingItem = 6;
  127.         SetCountItem = 7;
  128.         IterationsItem = 8;
  129.         OutlineItem = 10;
  130.         SkeletonizeItem = 11;
  131.         EDMItem = 13;
  132.         UltimateItem =14;
  133.         WatershedItem = 15;
  134.  
  135.         ArithmeticMenu = 37; {Sub Menu}
  136.         AddItem = 1;
  137.         SubtractItem = 2;
  138.         MultiplyItem = 3;
  139.         DivideItem = 4;
  140.         AndItem2 = 5;
  141.         OrItem2 = 6;
  142.         XorItem2 = 7;
  143.         LogItem = 8;
  144.  
  145.         BackgroundMenu = 40; {Sub Menu}
  146.         HorizontalItem = 1;
  147.         VerticalItem = 2;
  148.         Sub2DItem = 3;
  149.         RemoveStreaksItem = 4;
  150.         FasterItem = 6;
  151.         RadiusItem = 7;
  152.         
  153.         fftMenu = 45;  {Sub Menu}
  154.         ForewardFFTItem = 1;
  155.         InverseFFTItem = 2;
  156.         RedisplayItem = 4;
  157.         SwapItem = 5;
  158.     
  159.         AnalyzeMenu = 133;
  160.         MeasureItem = 1;
  161.         AnalyzeItem = 2;
  162.         ShowItem = 3;
  163.         HistogramItem = 4;
  164.         PlotItem = 5;
  165.         PlotSurfaceItem = 6;
  166.         OptionsItem = 7;
  167.         SetScaleItem = 9;
  168.         CalibrateItem = 10;
  169.         RedoItem = 11;
  170.         DeleteItem = 12;
  171.         ResetItem = 13;
  172.         RestoreItem = 14;
  173.         MarkItem = 15;
  174.  
  175.         SpecialMenu = 140;
  176.         StartItem = 1;
  177.         AverageItem = 2;
  178.         SaveBlankFieldItem = 3;
  179.         VideoControlItem = 4;
  180.         PhotoModeItem = 5;
  181.         LoadMacrosItem = 7;
  182.         FirstMacroItem = 9;
  183.  
  184.         StacksMenu = 141;
  185.         StackFromWindowsItem = 1;
  186.         WindowsFromStackItem = 2;
  187.         AddSliceItem = 3;
  188.         DeleteSliceItem = 4;
  189.         NextSliceItem = 5;
  190.         PreviousSliceItem = 6;
  191.         MakeMovieItem = 8;
  192.         CaptureFramesItem = 9;
  193.         AnimateItem = 10;
  194.         AverageSlicesItem = 11;
  195.         MakeMontageItem = 12;
  196.         CaptureColorItem = 14;
  197.         RGBToColorItem = 15;
  198.         ColorToRGBItem = 16;
  199.         RGBToHSVItem = 17;
  200.         RegisterItem = 19;
  201.         ProjectItem = 20;
  202.         ResliceItem = 21;
  203.         StackInfoItem = 22;
  204.  
  205.         WindowsMenu = 138;
  206.         NextImageItem = 1;
  207.         CascadeImagesItem = 2;
  208.         TileImagesItem = 3;
  209.         PasteControlItem = 4;
  210.         SelectToolsItem = 6;
  211.         SelectGrayMapItem = 7;
  212.         SelectLutItem = 8;
  213.         SelectInfoItem = 9;
  214.         SelectHistogramItem = 10;
  215.         SelectPlotItem = 11;
  216.         SelectResultsItem = 12;
  217.  
  218.         UserMenu = 139;
  219.  
  220.         TransferModeMenu = 200;  {Popup Menu in Paste Control window}
  221.         CopyModeItem = 1;
  222.         AndItem = 2;
  223.         OrItem = 3;
  224.         XorItem = 4;
  225.         ReplaceItem = 5;
  226.         BlendItem = 6;
  227.  
  228.         LineToolMenu = 201;
  229.         StraightItem = 1;
  230.         SegmentedItem = 2;
  231.         FreehandItem = 3;
  232.  
  233.         ImageMathOpsMenu = 202;
  234.         ImageListMenu = 203;
  235.         UnitsMenu = 204;
  236.  
  237.         InvertID = 1;
  238.         HighLightID = 2;
  239.         TriggerID = 3;
  240.         SyncID = 4;
  241.         FirstChannelID = 6;
  242.         OffsetID = 12;
  243.         GainID = 13;
  244.         OffsetUpID = 14;
  245.         OffsetDownID = 15;
  246.         GainUpID = 16;
  247.         GainDownID = 17;
  248.         ResetID = 18;
  249.  
  250.         MinFree = 150000;
  251.         HeaderSize = 512;
  252.         TiffDirSize = 256;
  253.         MaxLine = 4096;
  254.         tleft = 36;
  255.         ttop = 40;
  256.         twidth = 44;
  257.         tmiddle = 22;
  258.         theight = 277;
  259.         gmleft = 2;
  260.         gmtop = 338;
  261.         gmwidth = 78;
  262.         gmheight = 118;
  263.         gmRectLeft = 7;
  264.         gmRectTop = 6;
  265.         gmRectRight = 71;
  266.         gmRectBottom = 70;
  267.         gmSlideWidth = 68;
  268.         gmSlideHeight = 7;
  269.         gmSlide1Offset = 8;
  270.         gmSlide2Offset = 19;
  271.         gmIconWidth = 17;
  272.         gmIconHeight = 14;
  273.         gmIconOffset = 31;
  274.         gmIcon1Left = 17;
  275.         gmIcon2Left = 46;
  276.         cleft = 2;
  277.         ctop = 40;
  278.         cwidth = 30;
  279.         rwidth = 200;
  280.         rheight = 225;
  281.         hleft = 220;
  282.         hwidth = 256;
  283.         hheight = 120;
  284.         pcwidth = 186;
  285.         pcheight = 85;
  286.         MaxPseudoColors = 32;
  287.         MaxPseudoColorsLessOne = 31;
  288.         PicKind = 88;
  289.         HistoKind = 89;
  290.         ProfilePlotKind = 90;
  291.         LUTKind = 91;
  292.         MapKind = 92;
  293.         ToolKind = 93;
  294.         InfoKind = 94;
  295.         CalibrationPlotKind = 95;
  296.         PasteControlKind = 96;
  297.         ResultsKind = 97;
  298.         TextKind = 98;
  299.         IOErrorID = 400;
  300.         AboutID = 256;
  301.         VersItem = 2;
  302.         MemItem = 3;
  303.         StackSize = 40000;
  304.         ToolFont = 249;      {Bits 7-14 of font resource ID(31884) }
  305.         WindowsMenuItems = 13;       {Items in Windows menu before images - nTextWindows}
  306.         WhiteIndex = 0;
  307.         BlackIndex = 255;
  308.         OvalSize = 15;
  309.         LinesLeft = 13;
  310.         LinesRight = 40;
  311.         nLinetypes = 6;
  312.         CheckMarkChar = 65;
  313.         TxPlain = 1;
  314.         TxBold = 2;
  315.         TxItalic = 3;
  316.         TxUnderLine = 4;
  317.         TxOutLine = 5;
  318.         TxShadow = 6;
  319.         FileID8 = 'IPICIMAG';
  320.         DefaultBufferSize = 307200; {Enough for 640x480 image}
  321.         PickerCursorID = 111;
  322.         LUTCursorID = 112;
  323.         gmCursorID = 113;
  324.         GrabberCursorID = 114;
  325.         PencilCursorID = 115;
  326.         CrossCursorID = 117;
  327.         CrossCursorPlusID = 118;
  328.         CrossCursorMinusID = 119;
  329.         BucketCursorID = 120;
  330.         GlassCursorPlusID = 121;
  331.         GlassCursorMinusID = 122;
  332.         WandCursorID = 123;
  333.         WandPlusCursorID = 124;
  334.         WandMinusCursorID = 125;
  335.         TextCursorID = 126;
  336.         EraserCursorID = 127;
  337.         SprayCursorID = 128;
  338.         BrushCursorID = 129;
  339.         FirstAnimatedWatchID = 130;
  340.         FingerCursorID = 137;
  341.         AppleDefaultCLUT = 8;
  342.         SpectrumCLUT = 200;
  343.         KlutzID = 200;
  344.         PixelPaintID = 999; {Used for PixelPaint and Canvas CLUTs}
  345.         GhostWindow = $A84;
  346.         GrayRgnGlobal = $9EE;
  347.         MBarHeight = $BAA;
  348.         MaxPics = 250;
  349.         FirstExtraColorsEntry = 1;
  350.         MaxExtraColors = 6;
  351.         MaxExtraPlus2 = 8;
  352.         ExtraColorsHeight = 10;
  353.         MyMaxLong = 2000000000;
  354.         MaxTextBufSize = 32700;
  355.         MaxMaxRegions = 8000;
  356.         MaxStandards = 20;
  357.         BadReal = 808080.0;
  358.         NoValue = -808080.0;
  359.         TabSpacing = 12;
  360.         MaxPolyVertices = 4000;
  361.         pi = 3.1415926535898;
  362.         InfoVStart = 11;
  363.         InfoHStart = 4;
  364.     {TIFF Constants}
  365.         short = 3;
  366.         long = 4;
  367.         NewSubfileType = 254;
  368.         ImageWidth = 256;
  369.         ImageLength = 257;
  370.         BitsPerSample = 258;
  371.         Compression = 259;
  372.         PhotoInterp = 262;
  373.         StripOffsets = 273;
  374.         SamplesPerPixelTag = 277;
  375.         RowsPerStrip = 278;
  376.         StripByteCount = 279;
  377.         XResolution = 282;
  378.         YResolution = 283;
  379.         PlanarConfigTag = 284;
  380.         ResolutionUnit = 296;
  381.         ColorMapTag = 320;
  382.         ImageHdrTag = -22222; {43314}
  383.         TiffFillerSize = 58;
  384.         RoiHandleSize = 5;
  385.         CancelResetID = 3;
  386.         npcItems = 7;
  387. {Blend = 32;}
  388. {Transparent = 36;}
  389.         LeftArrow = 28;
  390.         RightArrow = 29;
  391.         UpArrow = 30;
  392.         DownArrow = 31;
  393.         hPicOffset = 8;
  394.         vPicOffset = 16;
  395.         FunctionKey = 16;
  396.  
  397.         MaxMacroSize = 20000;
  398.         MaxMacroFileSize = 32767;
  399.         MaxSymbols = 550;
  400.         MaxMacroStackSize = 200;
  401.         MaxMacros = 100;
  402.         SymbolSize = 12;
  403.         BlankSymbol = '            ';
  404.         StackOverflow = 'Stack overflow';
  405.  
  406.         MaxPicSize = 16383;
  407.         ScrollBarWidth = 15;
  408.         PrefsName = 'Image Prefs';
  409.         StraightChar = 97;
  410.         SegmentedChar = 98;
  411.         FreehandChar = 99;
  412.         {$IFC PowerPC}
  413.             MaxSlices = 5000;
  414.         {$ELSEC}
  415.             MaxSlices = 1000;
  416.         {$ENDC}
  417.         HomeKey = 1;
  418.         EndKey = 4;
  419.         PageUp = 11;
  420.         PageDown = 12;
  421.         osEvt = 15;
  422.         Pseudo20ID = 1001;
  423.         Pseudo32ID = 1002;
  424.         RainbowID = 1003;
  425.         Fire1ID = 1004;
  426.         Fire2ID = 1005;
  427.         IceID = 1006;
  428.         GraysID = 1007;
  429.         MaxColor = 15000;
  430.         MaxMaxCoordinates = 25000;
  431.         DefaultDacLow = 60;
  432.         DefaultDacHigh = 185;
  433.         MaxTextWindows = 10;
  434.         maxCoeff = 6;
  435.         maxLabelLength = 9;
  436.         maxTitle = 31;
  437.         maxUnit = 11;
  438.         maxUM = 15;
  439.         maxImageSize = 1000000000; {pixels}
  440.         
  441.  
  442.     type
  443.         LineType = packed array[0..MaxLine] of Byte;
  444.         LinePtr = ^LineType;
  445.         rLineType = array[0..MaxLine] of real;
  446.         rLinePtr = ^rLineType;
  447.         RealLine = array[1..MaxLine] of real;
  448.         ClutTable = packed array[0..255] of integer;
  449.         ColorArray = packed array[0..MaxPseudoColorsLessOne] of byte;
  450.         LutArray = packed array[0..255] of byte;
  451.         PicType = (NewPicture, Normal, PictFile, Leftover, imported, FrameGrabberType, NullPicture, BlankField, TiffFile, FourBitTIFF, PicsFile);
  452.         LUTModeType = (PseudoColor, OldAppleDefault, OldSpectrum, GrayScale, ColorLut, CustomGrayscale);
  453.         ColorTableType = (CustomTable, AppleDefault, Pseudo20, Pseudo32, Rainbow, Fire1, Fire2, Ice, Grays, Spectrum);
  454.         ExtraColorsArray = array[1..MaxExtraColors] of rgbColor;
  455.         MyCSpecArray = array[0..255] of ColorSpec;
  456.         CoefficientArray = array[1..maxCoeff] of extended;
  457.         CurveFitType = (StraightLine, Poly2, Poly3, Poly4, Poly5, ExpoFit, PowerFit, LogFit, RodbardFit, SpareFit1, Uncalibrated, UncalibratedOD);
  458.         UnitsType = (Nanometers, Micrometers, Millimeters, Centimeters, Meters, Kilometers, Inches, Feet, Miles, Pixels, OtherUnits);
  459.         UnitType = string[maxUnit];
  460.         FileDepthType = (EightBits, SixteenBitsUnsigned, SixteenBitsSigned, ThirtyTwoBits);
  461.         RoiTypeType = (PolygonRoi, RectRoi, OvalRoi, LineRoi, FreeLineRoi, SegLineRoi, NoRoi, FreehandRoi, TracedRoi);
  462.         StackTypeType = (VolumeStack, RGBStack, MovieStack, HSVStack);
  463.  
  464.         FakeDouble = array[1..2] of LongInt;
  465.         
  466.         PicHeader = record
  467.                 FileID: packed array[1..8] of char; {8  8}
  468.                 hnlines: integer;                    {2  10}
  469.                 hPixelsPerLine: integer;        {2  12}
  470.                 hversion: integer;                   {2  14}
  471.                 hOldLutMode: LutModeType;    {2  16}
  472.                 hOldnColors: integer;                {2  18}
  473.                 hr, hg, hb: ColorArray;              {96 114}
  474.                 hOldColorStart: integer;             {2  116}
  475.                 hColorWidth: integer;                 {2  118}
  476.                 hExtraColors: ExtraColorsArray;   {36 154}
  477.                 hnExtraColors: integer;              {2  156}
  478.                 hForegroundIndex: integer;     {2  158}
  479.                 hBackgroundIndex: integer;      {2  160}
  480.                 hXScale: FakeDouble;            {8  168}
  481.                 Unused2: integer;                    {2  170}
  482.                 Unused3: integer;                    {2  172}
  483.                 hUnitsID: integer;                   {2  174}
  484.                 hp1x, hp1y, hp2x, hp2y: integer;     {8  182}
  485.                 hfit: CurveFitType;                  {2  184}
  486.                 hnCoefficients: integer;           {2  186}
  487.                 hCoeff: array[1..maxCoeff] of FakeDouble; {48 234}
  488.                 hUM: string[maxUM];              {16 250}
  489.                 UnusedBoolean: boolean;          {1  251}
  490.                 hBinaryPic: boolean;               {1  252}
  491.                 hSliceStart: integer;           {2 254}
  492.                 hSliceEnd: integer;              {2  256}
  493.                 hScaleMagnification: real;   {4  260}
  494.                 hNSlices: integer;             {2 262}
  495.                 hSliceSpacing: real;          {4 266}
  496.                 hCurrentSlice: integer;        {2 268}
  497.                 hFrameInterval: real;          {4  272}
  498.                 hPixelAspectRatio: real;       {4  276}
  499.                 hColorStart: integer;             {2  278}
  500.                 hColorEnd: integer;               {2  280}
  501.                 hnColors: integer;                  {2  282}
  502.                 hFill1, hFill2: RGBColor;    {12  294}
  503.                 hTable: ColorTableType;       {1  295}
  504.                 hLutMode: LutModeType;      {1  296}
  505.                 hInvertedTable: boolean;      {1  297}
  506.                 hZeroClip: boolean;               {1  298}
  507.                 hXUnit: string[maxUnit];            {12 310}
  508.                 hStackType: StackTypeType;     {2  312}
  509.                 UnusedBytes: packed array[1..200] of byte;
  510.             end;
  511.  
  512.         StackInfoRec = record
  513.                 nSlices: integer;
  514.                 CurrentSlice: integer;
  515.                 PicBaseH: array[1..MaxSlices] of handle;
  516.                 SliceSpacing: real; {Pixels}
  517.                 FrameInterval: real; {seconds}
  518.                 StackType: StackTypeType;
  519.             end;
  520.         StackInfoPtr = ^StackInfoRec;
  521.  
  522.         PaletteHeader = record
  523.                 pID: packed array[1..4] of char;  {4  4}
  524.                 pVersion: integer;                              {2  6}
  525.                 pnColors: integer;                              {2  8}
  526.                 pColorStart: integer;                         {2  10}
  527.                 pColorEnd: integer;                            {2  12}
  528.                 pFill1: rgbColor;                               {6  18}
  529.                 pFill2: rgbColor;                               {6  24}
  530.                 pUnused: array[1..4] of integer;     {8  32}
  531.             end;
  532.  
  533.         RoiHeader = record
  534.                 rID: packed array[1..4] of char;  {4   4}
  535.                 rVersion: integer;                              {2   6}
  536.                 rRoiType: RoiTypeType;                    {2   8}
  537.                 rRoiRect: rect;                                   {8   16}
  538.                 rNCoordinates: integer;                     {2   18}
  539.                 rX1, rY1, rX2, rY2: real;                 {16 34}
  540.                 rLineWidth: integer;                          {2   36}
  541.                 rUnused: array[1..14] of integer;    {28 64}
  542.             end;
  543.  
  544.         PicInfo = record
  545.                 iVersion:LongInt;
  546.                 nlines, PixelsPerLine: LongInt;
  547.                 ImageSize: LongInt;
  548.                 BytesPerRow: LongInt;
  549.                 PicBaseAddr: ptr;
  550.                 PicBaseHandle: handle;
  551.                 DataH: handle;
  552.                 StackInfo: StackInfoPtr;
  553.                 osPort: cGrafPtr;         {Offscreen Port}
  554.                 PicRect: rect;
  555.                 RoiRect: rect;
  556.                 roiRgn: rgnHandle;
  557.                 RoiType: RoiTypeType;
  558.                 RoiShowing: boolean;
  559.                 SrcRect: rect;
  560.                 wrect: rect;
  561.                 initwrect: rect;
  562.                 xScale, yScale, zScale: extended;
  563.                 PixelAspectRatio: extended;
  564.                 xUnit: UnitType;  {Someday there may be yUnit}
  565.                 Fit: CurveFitType;
  566.                 nCoefficients: integer;
  567.                 Coefficient: CoefficientArray;
  568.                 ZeroClip: boolean;
  569.                 UnitOfMeasure: string[maxUM];
  570.                 LX1, LY1, LX2, LY2, LAngle: extended;
  571.                 savewrect, SaveSrcRect: rect;
  572.                 SaveMagnification: extended;
  573.                 savehloc, savevloc: integer;  {Old window location in global coordinates}
  574.                 title: string[maxTitle];
  575.                 NewPic: boolean;
  576.                 Magnification: extended;
  577.                 vref: integer;
  578.                 PictureType: PicType;
  579.                 wptr: WindowPtr;
  580.                 PicNum, PidNum: integer;
  581.                 ScaleToFitWindow: boolean;
  582.                 Changes: boolean;
  583.                 RedLUT, GreenLUT, BlueLUT: LutArray;
  584.                 nColors: LongInt;
  585.                 ColorStart, ColorEnd, SaveColorStart, SaveColorEnd: LongInt;
  586.                 FillColor1, FillColor2, SaveFill1, SaveFill2: RGBColor;
  587.                 LUTMode: LUTModeType;
  588.                 ColorTable: ColorTableType;
  589.                 InvertedColorTable: boolean;
  590.                 cTable: MyCSpecArray;
  591.                 IdentityFunction: boolean;
  592.                 PixMapSize: LongInt;
  593.                 HeaderOffset, ImageDataOffset, ColorMapOffset: LongInt;
  594.                 UnusedBoolean, SpatiallyCalibrated: boolean;
  595.                 BinaryPic: boolean;
  596.                 WindowState: (NormalWindow, TiledSmall, TiledSmallScaled, TiledBig, TiledBigScaled);
  597.                 Revertable: boolean;
  598.                 Thresholding: boolean;
  599.                 DataType: FileDepthType;
  600.                 AbsoluteMin, AbsoluteMax, CurrentMin, CurrentMax: LongInt;
  601.                 LittleEndian, InvertedImage: boolean;
  602.                 fileVersion:integer;
  603.             end;
  604.  
  605.         InfoPtr = ^PicInfo;
  606.         ToolType = (MagnifyingGlass, SelectionTool, Grabber, OvalSelectionTool, Pencil, PolygonTool, Eraser, FreehandTool, Brush, LineTool, ruler, LUTTool, PaintBucket, TextTool, PlotTool, SprayCanTool, Wand, PickerTool, AngleTool, CrossHairTool);
  607.         OpType = (InvertOp, PaintOp, FrameOp, EraseOp, PasteOp, AddOp, SubtractOp, MultiplyOp, DivideOp);
  608.         ObjectType = (lineObj, oval, SelectionOval, Rectangle, SelectionRect, BrushObj);
  609.         FilterType = (WeightedAvg, UnweightedAvg, fsharpen, SharpenMore, ShadowN, ShadowNE, ShadowE, ShadowSE, ShadowS, ShadowSW, ShadowW, ShadowNW, {}
  610.             EdgeDetect, FindEdges, ReduceNoise, dither, erosion, dilation, OutlineFilter, skeletonize, MinRankFilter, MaxRankFilter);
  611.         rhptr = ^RgnHandle;
  612.         FlipRotateType = (RotateLeft, RotateRight, FlipVertical, FlipHorizontal);
  613.         TextBackType = (NoBack, WithBack);
  614.         HistogramType = array[0..255] of LongInt;
  615.         str4 = packed array[1..4] of char;
  616.         LookupTable = packed array[0..255] of Byte;
  617.         TextBufType = packed array[1..MaxTextBufSize] of char;
  618.         TextBufPtr = ^TextBufType;
  619.         StandardsArray = array[1..MaxStandards] of extended;
  620.         MeasurementTypes = (AreaM, MeanM, StdDevM, xyLocM, ModeM, LengthM, MajorAxisM, MinorAxisM, AngleM, IntDenM, MinMaxM, User1M, User2M);
  621.         SetOfMeasurements = Set Of MeasurementTYpes;
  622.         TiffHdr = record
  623.                 ByteOrder: packed array[1..2] of char;
  624.                 Version: integer;
  625.                 FirstIFDOffset: LongInt;
  626.             end;
  627.         TiffEntry = record
  628.                 TagField: integer;
  629.                 ftype: integer;
  630.                 length: LongInt;
  631.                 offset: LongInt;
  632.             end;
  633.         pcItemType = (pcPopupMenu, pcCheckBox, pcButton);
  634.         WhatToImportType = (ImportTIFF, ImportMCID, ImportLUT, ImportText, ImportCustom, ImportDICOM);
  635.         FateTable = array[0..255] of integer;
  636.         SaveAsWhatType = (asTIFF, asPICT, asQuickTime, asPICS, AsPalette, AsOutline, AsRawData, SaveAsMCID);
  637.         ExportAsWhatType = (AsRaw, asMCID, asText, AsLUT, asMeasurements, asPlotValues, asHistogramValues, asCoordinates);
  638.  
  639.         RealArray = array[0..MaxMaxRegions] of real;
  640.         meanType = RealArray;
  641.         sdType = RealArray;
  642.         PixelCountType = array[0..MaxMaxRegions] of LongInt;
  643.         AreaType = RealArray;
  644.         modeType = RealArray;
  645.         IntegratedDensityType = RealArray;
  646.         idBackgroundType = RealArray;
  647.         xcenterType = RealArray;
  648.         ycenterType = RealArray;
  649.         MajorAxisType = RealArray;
  650.         MinorAxisType = RealArray;
  651.         orientationType = RealArray;
  652.         MinType = RealArray;
  653.         MaxType = RealArray;
  654.         plengthType = RealArray;
  655.         User1Type = RealArray;
  656.         User2Type = RealArray;
  657.  
  658.         meanPtr = ^meanType;
  659.         sdPtr = ^sdType;
  660.         PixelCountPtr = ^PixelCountType;
  661.         AreaPtr = ^AreaType;
  662.         modePtr = ^modeType;
  663.         IntegratedDensityPtr = ^IntegratedDensityType;
  664.         idBackgroundPtr = ^idBackgroundType;
  665.         xcenterPtr = ^xcenterType;
  666.         ycenterPtr = ^ycenterType;
  667.         MajorAxisPtr = ^MajorAxisType;
  668.         MinorAxisPtr = ^MinorAxisType;
  669.         orientationPtr = ^orientationType;
  670.         MinPtr = ^MinType;
  671.         MaxPtr = ^MaxType;
  672.         plengthPtr = ^plengthType;
  673.         User1Ptr = ^User1Type;
  674.         User2Ptr = ^User2Type;
  675.         SyncModeType = (NormalSync, SeparateSync, SyncOnGreen);
  676.         
  677. {ppc-bug}
  678.         TokenTypeX = (NullT, MacroT, NewLineT, beginT, endT, Identifier, UnknownIdentifier, DoneT, LeftParen,
  679.             RightBracket, comma, colon, SemiColon, StringLiteral, NumericLiteral, VarT, IntegerT, RealT, BooleanT, CommandT,
  680.             FunctionT, ArrayT, AssignOp, ForT, ToT, DoT, IfT, ThenT, ElseT, whileT, repeatT, untilT, Variable, PlusOp,
  681.             MinusOp, MulOp, DivOp, eqOP, ltOp, gtOp, neOp, leOp, geOp, orOp, IntDivOp, modOp, andOp, NotOp, ProcedureT,
  682.             ProcIdT, TrueT, FalseT, RightParen, LeftBracket, StringT, StringVariable,
  683.             StringFunctionT, UserFunctionT, UserFuncIDT);
  684.             
  685.     CommandType = (InvertLUTC, UserCodeC, MoveWindowC, AutoThresholdC, SetExportC, SubtractBackgroundC,
  686.             SetUser1C, SetUser2C, GetPlotDataC, RequiresC, SetOptionsC, GetSpacingC, SetSpacingC,
  687.             PropagateLutC, PropagateDensityC, PropagateSpatialC, SetCountC, ShowMsgC, UpdateLutC, SetCounterC,
  688.             SaveStateC, RestoreStateC, GetTimeC, SetScaleC, MakeLineC, PlotProfileC, ResliceC, CopyModeC,
  689.             TriggerC, AverageFramesC, AddSliceC, DeleteSliceC, MakeStackC, GetSliceC, nSlicesC, SelectSliceC, ChooseSliceC,
  690.             GetMouseC, SetMajorC, SetMinorC, TileC, UpdateResultsC, rCountC, ChangeC, ExportC, PicNumC,
  691.             ScaleSelectionC, ScalingOptionsC, PutPixelC, ChoosePicC, WriteC, WritelnC,
  692.             SetPrecisionC, SetParticleSizeC, AdjustC, IgnoreC,
  693.             OutlineParticlesC, LabelC, IncludeC, AutoC, PlotXYZC, CalibratedC, cValueC, SameSizeC, GetColumnC, PutColumnC,
  694.             GetRowC, PutRowC, ShowResultsC, SetWidthC, ScaleMathC, InvertYC, AndC, OrC, XorC, BlendC, ReplaceC, AddC, SubC,
  695.             MulC, DivC, SetOptionC, GetResultsC, SetLabelsC, SetPlotScaleC, SetDimC, ColumnC, ChannelC, ShowPasteC, NullC,
  696.             RotateRC, RotateLC, FlipVC, FlipHC, CopyC, SelectC, ClearC, FillC, InvertC, FrameC, PasteC, KillC, RestoreC, AnalyzeC,
  697.             ConvolveC, NextC, MarkC, MeasureC, ThresholdC, ResetgmC, MakeBinC, DitherC, SmoothC, SharpenC, ShadowC,
  698.             TraceC, ReduceC, SetSliceC, RedirectC, WaitC, ResetmC, UndoC, SetForeC, SetBackC, ScaleC, HistoC, EnhanceC,
  699.             EqualizeC, ErodeC, DilateC, OutlineC, ThinC, AddConstC, MulConstC, RevertC, BeepC, NopC, MakeC, MakeOvalC,
  700.             MoveC, InsetC, MoveToC, LineToC, DrawTextC, DrawNumC, SetFontC, SetFontSizeC, SetTextC, GetPicSizeC, PutMsgC,
  701.             ExitC, GetRoiC, TruncC, RoundC, GetNumC, StartC, StopC, CaptureC, RandomC, MakeNewC, DrawScaleC, SetPaletteC,
  702.             GetPixelC, ButtonC, oddC, absC, sqrtC, sinC, cosC, expC, lnC, arctanC, sqrC, OpenC, ImportC, SetImportC, SetMinMaxC,
  703.             SetCustomC, nPicsC, SelectPicC, SetPicNameC, ApplyLutC, SetSizeC, SaveC, SaveAllC, SaveAsC, CopyResultsC, CloseC,
  704.             DisposeC, DisposeAllC, DupC, GetInfoC, PrintC, GetLineC, nCoordinatesC, GetStringC,
  705.             OpenSerialC, GetSerialC, PutSerialC, ChrC, OrdC, SetCursorC, TickCountC, ConcatC, SetVideoC, StringToNumC, AcquireC,
  706.             UndoSizeC, CallFilterC, PhotoModeC, RGBToIndexedC, SurfacePlotC, SelectWindowC, NewTextWindowC, CaptureColorC,
  707.             GetThresholdC, AverageSlicesC, BitAndC, BitOrC, PidNumC, SortPaletteC, ProjectC, WindowTitleC, ScaleConvolutionsC,
  708.             ImageMathC, PasteLiveC, PidExistsC, PosC, DeleteC, LengthC, GetScaleC, AutoOutlineC, FilterC, SetSaveAsC,
  709.             CalibrateC, CallExportC, KeyDownC, IndexedToRgbC, MakeMovieC, SetProjectionC, GetHistogramC, GetC, fftC,
  710.             GetPathC, GetFileInfoC, SelectToolC, BinaryC);
  711.  
  712.         ArrayType = (HistogramA, rAreaA, rMeanA, rXA, rYA, rLengthA, rMajorA, rMinA, rMaxA, rUser1A, rUser2A, rMinorA,
  713.             rAngleA, RedLutA, GreenLutA, BlueLutA, rStdDevA, BufferA, PlotDataA, xCoordinatesA, yCoordinatesA, ScionA);
  714.  
  715.         SymbolType = packed array[1..SymbolSize] of char;
  716.         VarType = (IntVar, RealVar, BooleanVar, StringVar);
  717.         SymTabRec = record
  718.                 Symbol: SymbolType;
  719.                 tType: TokenTypeX;
  720.                 cType: CommandType;
  721.                 loc: integer;
  722.             end;
  723.         str255P = ^str255;
  724.         str255H = ^str255P;
  725.         StackRec = record
  726.                 SymbolTableIndex: integer;
  727.                 Value: extended;
  728.                 vType: VarType;
  729.                 StringH: str255H;
  730.             end;
  731.         MacrosRec = record
  732.                 Macros: packed array[0..MaxMacroSize] of char;
  733.                 SymbolTable: array[1..MaxSymbols] of SymTabRec;
  734.                 stack: array[1..MaxMacroStackSize] of StackRec;
  735.                 aLine: LineType;
  736.             end;
  737.         MacrosPtr = ^MacrosRec;
  738.         rsMethodType = (Bilinear, NearestNeighbor);
  739.         TiffColorMapType = array[1..3] of array[0..255] of integer;
  740.         StackIFDType = record
  741.                 nEntries: integer; {2}
  742.                 TiffDir: array[1..6] of TiffEntry; {72}
  743.                 NextIFD: LongInt;  {4}
  744.             end;
  745.         VideoDigitizerStandard = (defaultStd, NTSCStd, PALStd, SECAMStd);
  746.         VideoDigitizerMode = (digitizeGrayscale, digitizeColor, digitizeRGB);
  747.  
  748.         SettingsType = record
  749.                 sID: packed array[1..4] of char;
  750.                 sVersion: integer;
  751.                 sForegroundIndex, sBackgroundIndex: integer;
  752.                 sBrushHeight, sBrushWidth: integer;
  753.                 sSprayCanDiameter: integer;
  754.                 sLUTMode: LUTModeType;
  755.                 sOldColorStart: integer;
  756.                 sOldColorWidth: integer;
  757.                 sCurrentFontID: integer;
  758.                 sCurrentStyle: style;
  759.                 sCurrentSize: integer;
  760.                 sTextJust: integer;
  761.                 sTextBack: TextBackType;
  762.                 snExtraColors: integer;
  763.                 sExtraColors: ExtraColorsArray;
  764.                 sInvertVideo: boolean;
  765.                 sMeasurements: SetOfMeasurements;
  766.                 sInvertPlots, sAutoScalePlots, sLinePlot, sDrawPlotLabels, sFixedSizePlot: boolean;
  767.                 sUnused1: packed array[1..12] of integer;
  768.                 sProfilePlotWidth, sProfilePlotHeight: integer;
  769.                 sFramesToAverage: integer;
  770.                 sNewPicWidth, sNewPicHeight: integer;
  771.                 sBufferSize: LongInt;
  772.                 sUnused3: integer;
  773.                 sThresholdToForeground, sNonThresholdToBackground: boolean;
  774.                 sVideoChannel: integer;
  775.                 sWhatToImport: WhatToImportType;
  776.                 sImportCustomWidth, sImportCustomHeight: integer;
  777.                 sImportCustomOffset: LongInt;
  778.                 sWandAutoMeasure, sWandAdjustAreas: boolean;
  779.                 sBinaryIterations: integer;
  780.                 sScaleArithmetic: boolean;
  781.                 sInvertPixelValues: boolean;
  782.                 sInvertYCoordinates: boolean;
  783.                 sFieldWidth, sPrecision: integer;
  784.                 sMinParticleSize, sMaxParticleSize: LongInt;
  785.                 sIgnoreParticlesTouchingEdge, sLabelParticles, sOutlineParticles, sIncludeHoles: boolean;
  786.                 sKernelsVRefNum: integer;
  787.                 sKernelsDirID: LongInt;
  788.                 sDefaultVRefNum: integer;
  789.                 sDefaultDirID: LongInt;
  790.                 sOscillatingMovies: boolean;
  791.                 sDriverHalftoning: boolean;
  792.                 sMaxMeasurements: integer;
  793.                 sImportCustomDepth: FileDepthType;
  794.                 sImportSwapBytes, sImportCalibrate, sImportAutoscale: boolean;
  795.                 sUnused2: packed array[1..12] of integer;
  796.                 sShowHeadings: boolean;
  797.         {Added with V1.40}
  798.                 sProfilePlotMin, sProfilePlotMax: real;
  799.                 sImportMin, sImportMax: real;
  800.                 sHighlightPixels: boolean;
  801.         {Added with V1.41}
  802.                 sBallRadius: integer;
  803.                 sFasterBackgroundSubtraction: boolean;
  804.                 sScaleConvolutions: boolean;
  805.        {Added with V1.42}
  806.                 sBinaryCount: integer;
  807.                 sColorTable: ColorTableType;
  808.                 sColorStart, sColorEnd: integer;
  809.                 sInvertedTable: boolean;
  810.        {Added with V1.44}
  811.                 sHalftoneFrequency, sHalftoneAngle: integer;
  812.                 sHalftoneDotFunction: boolean;
  813.        {Added with V1.46}
  814.                 sDacLow, sDacHigh: integer;
  815.       {Added with V1.47}
  816.                 sSyncMode: SyncModeType;
  817.       {Added with V1.49}
  818.                 sSwitchLUTOnSuspend: boolean;
  819.                 sVideoRateAveraging: boolean;
  820.       {Added with V1.50}
  821.                 sImportInvert: boolean;
  822.       {Added with V1.52}
  823.                 sTextCreator: packed array[1..4] of char;
  824.       {Added with V1.56}
  825.           sMathSubGain: real;
  826.           sMathSubOffset: LongInt;
  827.       {Added with V1.60}
  828.           sfgScale: integer;
  829.                 sUseBuiltinDigitizer: boolean;
  830.                 sDigitizerMode: VideoDigitizerMode;
  831.                 sDigitizerStandard: VideoDigitizerStandard;
  832.                 sLutFriendlyMode: boolean;
  833.                 sUnused: array[1..10] of LongInt;
  834.             end;
  835.  
  836.         TiffInfoRec = record
  837.                 Width, Height: integer;
  838.                 BitsPerPixel: integer;
  839.                 SamplesPerPixel: integer;
  840.                 PlanarConfig: integer;
  841.                 ZeroIsBlack: boolean;
  842.                 OffsetToData, OffsetToColorMap, OffsetToImageHeader: LongInt;
  843.                 Resolution: extended;
  844.                 ResUnits: (tCentimeters, tInches, tNoUnits);
  845.                 NextIFD: LongInt;
  846.             end;
  847.  
  848.         TiffIFDTable = array[1..MaxSlices] of record
  849.                 iWidth, iHeight: integer;
  850.                 Offset: LongInt;
  851.                 Invert: boolean;
  852.             end;
  853.         TiffIFDTablePtr = ^TiffIFDTable;
  854.  
  855.         PaletteRecType = record
  856.                 NumberOfColors: integer;
  857.                 RedData: ColorArray;
  858.                 GreenData: ColorArray;
  859.                 BlueData: ColorArray;
  860.             end;
  861.  
  862.         ProjectionMethodType = (NearestPoint, BrightestPoint, MeanValue);
  863.         AxisType = (XAxis, YAxis, ZAxis);
  864.         FiducialMethodType = (OnScreen, FromFile);
  865.  
  866.         CoordinatesType = array[1..MaxMaxCoordinates] of integer;
  867.         xCoordinatesPtr = ^CoordinatesType;
  868.         yCoordinatesPtr = ^CoordinatesType;
  869.         WhatToUndoType = (NothingToUndo, UndoEdit, UndoFlip, UndoRotate, UndoFilter, UndoPaste, UndoTransform, UndoClear, UndoMeasurement, UndoPoint, UndoZoom, UndoOutline, UndoSliceDelete, UndoFirstSliceDelete, UndoLUT);
  870.  
  871.         TextInfoRec = record
  872.                 TextWindowPtr: WindowPtr;
  873.                 TextLeft, TextTop, TextWidth, TextHeight: integer;
  874.                 hTextScrollBar, vTextScrollBar: ControlHandle;
  875.                 hTextPageSize, vTextPageSize: integer;
  876.                 TextTE: TEHandle;
  877.                 TextTitle: str255;
  878.                 TextRefNum: integer;
  879.                 Changes, TooBig: boolean;
  880.                 WindowNum: integer;
  881.             end;
  882.         TextInfoPtr = ^TextInfoRec;
  883.  
  884.         ImageData = packed array[0..maxImageSize] of byte;
  885.         ImageP = ^ImageData;
  886.         
  887.         rImageData = packed array[0..maxImageSize] of real;
  888.         rImagePtr = ^rImageData;
  889.  
  890.         eType=(e1,e2,e3);
  891.         uPtr=^byte; {pointer to unsigned bytes}
  892.         fftType = (ForewardFFT, InverseFFT, InverseFFTWithMask, InverseFFTWithFilter);
  893.         
  894.     var
  895.         TraceInfo: str4;
  896.         finished: boolean;
  897.         trect, gmrect, MapRect1, MapRect2, crect, HistoRect: rect;
  898.         gmSlide1, gmslide2, gmSlide1i, gmSlide2i, gmicon1, gmicon2: rect;
  899.         ToolWindow, MapWindow, LUTWindow, InfoWindow, HistoWindow, PlotWindow, PasteControl: WindowPtr;
  900.         BuggyWatch: CursHandle;
  901.         cr, tab, BackSpace, eofChr: char;
  902.         crStr:string[1]; {ppc-bug}
  903.         CharCount: LongInt;
  904.         ScreenPort: GrafPtr;
  905.         CScreenPort: cGrafPtr;
  906.         ipTicks:LongInt;
  907.         MonoFunction: ClutTable;
  908.         Info: InfoPtr;
  909.         ToolCursor: array[ToolType] of Cursor;
  910.         AnimatedWatch: array[1..8] of Cursor;
  911.         WatchIndex: integer;
  912.         PickerCursor, LUTCursor, gmCursor, CrossPlusCursor, CrossMinusCursor, GlassMinusCursor, watch, WandPlusCursor, WandMinusCursor, FingerCursor: Cursor;
  913.         CurrentTool, PreviousTool, FirstTool, LastTool: ToolType;
  914.         ToolRect: array[ToolType] of rect;
  915.         ToolTime, LutTime: longInt;
  916.         nPics, nextPid: integer;
  917.         PicWindow: array[1..MaxPics] of WindowPtr;
  918.         ScreenWidth, ScreenHeight: integer;
  919.         ScreenBase: ptr;
  920.         ScreenRowBytes: LongInt;
  921.         ScreenPixMap: PixMapHandle;
  922.         Histogram: HistogramType;
  923.         HistogramSliceStart, HistogramSliceEnd: integer;
  924.         ForegroundIndex, BackgroundIndex: integer;
  925.         lines: array[1..nLineTypes] of rect;
  926.         CheckRect: rect;
  927.         LineWidth, LineIndex: integer;
  928.         StartOfLines: integer;
  929.         MaskRgn: RgnHandle;
  930.         PlotPICT: PicHandle;
  931.         PlotLeft, PlotTop, PlotWidth, PlotHeight, PlotPicNum: integer;
  932.         PlotMin, PlotMax, ActualPlotMin, ActualPlotMax: extended;
  933.         PlotCount, PlotAvg: integer;
  934.         PlotData: rLinePtr;
  935.         PlotAngle, PlotScale: extended;
  936.         PlotStart: point;
  937.         PlotXUnits, PlotYUnits: string[MaxUM];
  938.         InvertPlots, AutoscalePlots, LinePlot, DrawPlotLabels, FixedSizePlot: boolean;
  939.         ProfilePlotMin, ProfilePlotMax: extended;
  940.         ProfilePlotWidth, ProfilePlotHeight: integer;
  941.         UndoBuf, ClipBuf, BigBuf: ptr;
  942.         ClipBufSize, UndoBufSize, BigBufSize: LongInt;
  943.         UndoInfoRec: PicInfo;
  944.         UndoInfo: InfoPtr;
  945.         CurrentUndoSize: LongInt;
  946.         SprayCanDiameter, SprayCanRadius, SprayCanRadius2: integer;
  947.         BrushHeight, BrushWidth: integer;
  948.         CurrentFontID, CurrentSize, NumFontItems: integer;
  949.         CurrentStyle: Style;
  950.         InsertionPoint: point; {Offscreen coordinates}
  951.         IsInsertionPoint: boolean;
  952.         TextJust: integer;
  953.         TextBack: TextBackType;
  954.         TextStr: str255;
  955.         TextRect: rect;
  956.         TextStart: point;
  957.         BlinkTime: LongInt;
  958.         AntPattern: array[0..7] of pattern;
  959.         PatIndex: integer;
  960.         OpPending: boolean;
  961.         CurrentOp: OpType;
  962.         IsOK: boolean;
  963.         PicLeftBase, PicTopBase, PicLeft, PicTop: integer;
  964.         ClipBufInfoRec: PicInfo;
  965.         ClipBufInfo: InfoPtr;
  966.         MouseState: (NotInRoi, InRoi, DownInRoi);
  967.         osMouseDownLoc: point;
  968.         OldRoiRect: rect;
  969.         WhatsOnClip: (NothingOnClip, AColor, RectPic, NonRectPic, ImportedPic, CameraPic, TextOnClip, LivePic);
  970.         ClipTextInBuffer: boolean;
  971.         ExtraColors: ExtraColorsArray;
  972.         nExtraColors: integer;
  973.         PasteTransferMode: integer;
  974.         cheight: integer;
  975.         ExtraColorsRect: array[1..MaxExtraPlus2] of rect;
  976.         ExtraColorsEntry: array[1..MaxExtraPlus2] of integer;
  977.         RoiMode: (MoveMode, StretchMode, LeftEndMode, RightEndMode);
  978.         OldScrapCount: integer;
  979.         ClipboardConverted: boolean;
  980.         results: record
  981.                 UncalibratedMean: extended;
  982.                 MinIndex, MaxIndex, imode: integer;
  983.             end;
  984.         FrameGrabber: (QuickCapture, ScionLG3, ScionAG5, ScionVG5f, QTvdig, NoFrameGrabber);
  985.         fgSlotBase, fgRowBytes: LongInt;
  986.         ControlReg, ChannelReg, BufferReg, DacHighReg, DacLowReg: ptr;
  987.         Digitizing: boolean;
  988.         debugging: boolean;
  989.         NoInfo: InfoPtr;
  990.         NoInfoRec: PicInfo;
  991.         UndoFromClip: boolean;
  992.         DensitySlicing, ThresholdToForeground, NonThresholdToBackground: boolean;
  993.         SliceStart, SliceEnd: integer;
  994.         SliceColor: RGBColor;
  995.         BlankFieldInfo: InfoPtr;
  996.         BlankFieldMean: integer;
  997.         InvertVideo, HighlightSaturatedPixels: boolean;
  998.         VideoChannel: integer;
  999.         TextBufSize, TextBufColumn: integer;
  1000.         TextBufLineCount: LongInt;
  1001.         TextBufP: TextBufPtr;
  1002.         BitInfoCount: integer;
  1003.         mCount, mCount2: integer;
  1004.         nPoints, nLengths, nAngles: integer;
  1005.         umean: array[0..MaxStandards] of extended; {Uncalibrated means}
  1006.         StandardValues: StandardsArray;
  1007.         nStandards, nKnownValues: integer;
  1008.         cvalue: array[0..255] of extended;
  1009.         minCValue, maxCValue, FitGoodness, FitSD: extended;
  1010.         PlotLeftMargin, PlotTopMargin, PlotBottomMargin, PlotRightMargin: integer;
  1011.         WhatToUndo: WhatToUndoType;
  1012.         WhatToCopy: (NothingToCopy, CopySelection, CopyCLUT, CopyGrayMap, CopyTools, CopyPlot, CopyCalibrationPlot, CopyHistogram, CopyMeasurements, CopyColor, CopyText);
  1013.         WhatToPrint: (NothingToPrint, PrintImage, PrintSelection, PrintMeasurements, PrintPlot, PrintHistogram, PrintText);
  1014.         PrintRecord: THPrint;
  1015.         isLaserWriter: boolean;
  1016.         printing: boolean;
  1017.         HalftoneFrequency, HalftoneAngle: integer;
  1018.         HalftoneDotFunction: boolean;
  1019.         AppleMenuH, FileMenuH, AcquireMenuH, ExportMenuH, EditMenuH, OptionsMenuH, ColorTablesMenuH, {}
  1020.         PropagateMenuH, ProcessMenuH, FilterMenuH, BinaryMenuH, ArithmeticMenuH, BackgroundMenuH, {}
  1021.         AnalyzeMenuH, SpecialMenuH, StacksMenuH, SortPaletteMenuH, FontMenuH, SizeMenuH, StyleMenuH, {}
  1022.         WindowsMenuH, UserMenuH, TransferModeMenuH, LineToolMenuH, ImageMathOpsMenuH, ImageListMenuH, {}
  1023.         UnitsMenuH, fftMenuH: MenuHandle;
  1024.         rleft, rtop: integer;
  1025.         ListDone: boolean;
  1026.         ResultsWindow: WindowPtr;
  1027.         hScrollBar, vScrollBar: ControlHandle;
  1028.         ListTE: TEHandle;
  1029.         hListPageSize, vListPageSize: integer;
  1030.         measuring: boolean;
  1031.         Measurements: SetOfMeasurements;
  1032.         nListColumns: integer;
  1033.         FramesToAverage: LongInt;
  1034.         xLabel, yLabel, zLabel: string[31];
  1035.         xValueLoc, yValueLoc, zValueLoc: integer;
  1036.         MenuBarHeight: integer;
  1037.         NewPicWidth, NewPicHeight: LongInt;
  1038.         RestoreUndoBuf: boolean;
  1039.         WhatToOpen: (OpenImage, OpenPICT2, OpenTIFF, OpenMCID, OpenUnknown, OpenImported, OpenCustom);
  1040.         WhatToImport: WhatToImportType;
  1041.         ImportCustomWidth, ImportCustomHeight, ImportCustomSlices: LongInt;
  1042.         ImportCustomOffset: LongInt;
  1043.         ImportCustomDepth: FileDepthType;
  1044.         ImportSwapBytes, ImportAll, ImportCalibrate, ImportInvert: boolean;
  1045.         IntelByteOrder: boolean;
  1046.         BufferSize: LongInt;
  1047.         isSelectionTool: boolean;
  1048.         SelectionMode: (NewSelection, AddSelection, SubSelection);
  1049.         RoiMovementState: (Unconstrained, Constrained, ConstrainedH, ConstrainedV);
  1050.         pcItem: array[1..npcItems] of record
  1051.                 r: rect;
  1052.                 itype: pcItemType;
  1053.                 str: string[20];
  1054.             end;
  1055.         PictF: integer;
  1056.         PictBuffer, curPictBufPtr: ptr;
  1057.         BytesInPictBuffer: LongInt;
  1058.         FitsInPictBuffer, RoiNudged, GrayMapReady, RedoSelection: boolean;
  1059.         ThresholdingMode: (DensitySlice, GrayMapThresholding, BinaryImage, NoThresholding);
  1060.         WandAutoMeasure, WandAdjustAreas, RedirectSampling: boolean;
  1061.         LabelParticles, OutlineParticles, IgnoreParticlesTouchingEdge, IncludeHoles: boolean;
  1062.         MinParticleSize, MaxParticleSize: LongInt;
  1063.         OptionKeyWasDown, ScaleArithmetic, FitEllipse, AnalyzingParticles: boolean;
  1064.         WhiteRGB, BlackRGB: RGBColor;
  1065.         BinaryIterations: integer;
  1066.         nMonitors: integer;
  1067.         Monitors: array[1..6] of GDHandle;
  1068.         InfoMessage: str255;
  1069.         fgStartTicks, fgFrameCount: LongInt;
  1070.         SaveAsWhat: SaveAsWhatType;
  1071.         ExportAsWhat: ExportAsWhatType;
  1072.         SaveAllState: (NoSaveAll, SaveAllStage1, SaveAllStage2);
  1073.         InvertPixelValues, InvertYCoordinates, ContinuousHistogram: boolean;
  1074.         fgPort: cGrafPtr;
  1075.         fgPixMap: PixMapHandle;
  1076.         fgWidth, fgHeight, fgScale: integer;
  1077.         RoiUpdateTime: LongInt; {Time required to draw ROI outline. Set to 0 to force redraw.}
  1078.         FieldWidth: integer;
  1079.         Precision: integer; {Digits to right of decimal point}
  1080.         MeasurementToRedo: integer;
  1081.         Has32BitQuickDraw: boolean;
  1082.         DefaultRefNum, KernelsRefNum, MacrosRefNum: integer;
  1083.         LaunchVRefNum, PlugInsVRefNum: integer;
  1084.         LaunchDirID, PlugInsDirID: LongInt;
  1085.         DefaultFileName: string[63];
  1086.         rsHScale, rsVScale, rsAngle: extended; {Rotate and Scale Parameters}
  1087.         rsMethod: rsMethodType;
  1088.         rsCreateNewWindow: boolean;
  1089.         rsInteractive: boolean;
  1090.         TextEol, TextEof: boolean;
  1091.         Textf, TextIndex: integer;
  1092.         TextFileSize: LongInt;
  1093.         nMacros, nSymbols: integer;
  1094.         pcStart, TopOfStack, CurrentX, CurrentY, EndMacros: integer;
  1095.         nProcedures, TokenLoc, TokenStackLoc, SavePC, nGlobals, SymbolTableLoc: integer;
  1096.         LegalWithoutImage: set of CommandType;
  1097.         SaveForeground: integer;
  1098.         PC: integer; {"program counter" used by macro interpreter}
  1099.         MacroLineNumber: integer;
  1100.         MacroStart: array[1..MaxMacros] of integer;
  1101.         MacroKey: packed array[1..MaxMacros] of char;
  1102.         Token, SaveToken:TokenTypeX;
  1103.         TokenStr: str255;
  1104.         TokenSymbol, MacroOrProcName: SymbolType;
  1105.         TokenValue: extended;
  1106.         Macro: boolean; {True if macro is running.}
  1107.         MacrosP: MacrosPtr;
  1108.         MacroCommand: CommandType;
  1109.         SerialIn, SerialOut: integer;
  1110.         SerialBufferP: ptr;
  1111.         ImportAutoScale: boolean;
  1112.         ImportMin, ImportMax: extended;
  1113.         OscillatingMovies, DriverHalftoning: boolean;
  1114.         ExplicitPalette: PaletteHandle;
  1115.         LivePasteMode: boolean;
  1116.         ShowCount: boolean;
  1117.         PasteControlLeft, PasteControlTop: integer;
  1118.         MaxMeasurements, MaxCoordinates: integer;
  1119.         mean: meanPtr;
  1120.         sd: sdPtr;
  1121.         PixelCount: PixelCountPtr;
  1122.         mArea: AreaPtr;
  1123.         mode: modePtr;
  1124.         IntegratedDensity: IntegratedDensityPtr;
  1125.         idBackground: idBackgroundPtr;
  1126.         xcenter: xcenterPtr;
  1127.         ycenter: ycenterPtr;
  1128.         MajorAxis: MajorAxisPtr;
  1129.         MinorAxis: MinorAxisPtr;
  1130.         orientation: orientationPtr;
  1131.         mMin: MinPtr;
  1132.         mMax: MaxPtr;
  1133.         plength: plengthPtr;
  1134.         User1: User1Ptr;
  1135.         User2: User2Ptr;
  1136.         ResultsLeft, ResultsTop, ResultsWidth, ResultsHeight: integer;
  1137.         UnsavedResults: boolean;
  1138.         MajorLabel, MinorLabel, User1Label, User2Label: string[maxLabelLength];
  1139.         OldSystem, System7: boolean;
  1140.         SystemRefNum: integer;
  1141.         ShowHeadings: boolean;
  1142.         MakingLOI: boolean;
  1143.         LOIType: (Straight, Freehand, Segmented);
  1144.         MakingStack: boolean;
  1145.         FramesWanted: integer;
  1146.         ScaleConvolutions: boolean;
  1147.         FasterBackgroundSubtraction: boolean;
  1148.         BallRadius: integer;
  1149.         DelayTicks: integer;
  1150.         CmdPeriodToStop: string[21];
  1151.         CommandKey: char;
  1152.         BinaryCount, BinaryThreshold: integer;
  1153.         ClipboardColor: rgbColor;
  1154.         InitAngle, TotalAngle, AngleInc,                 {initial, total, and incremental angles of volume rotation}
  1155.         TransparencyLower,                                   {pixels below this threshold are transparent}
  1156.         TransparencyUpper,                                   {pixels above this threshold are transparent}
  1157.         Opacity,                                                       {percentage nearest-point in a combined projection}
  1158.         DepthCueSurf,                                             {depth-cueing constant for nearest-pt component}
  1159.         DepthCueInt: integer;                                  {depth-cueing constant for other projection components}
  1160.         AxisOfRotation: AxisType;                           {project volume as it rotates about x,y,or z-axis}
  1161.         SaveProjections,                                         {if TRUE, save and close proj frames once created}
  1162.         MinProjSize: boolean;                                {if FALSE, make windows same size regardless of rotation axis}
  1163.         ProjectionMethod: ProjectionMethodType;
  1164.         MeterWindow: WindowPtr;
  1165.         xCoordinates: xCoordinatesPtr;
  1166.         yCoordinates: yCoordinatesPtr;
  1167.         nCoordinates: integer;
  1168.         CoordinatesWidth, CoordinatesHeight: integer;
  1169.         CoordinatesRoiType: RoiTypeType;
  1170.         SwitchLUTOnSuspend: boolean;
  1171.         SumFrames, ExternalTrigger, BlindMovieCapture, ShowIntegratedValues, FixIntegrationScale: boolean;
  1172.         IntegrationMin, IntegrationMax: LongInt;
  1173.         DacHigh, DacLow: integer;
  1174.         MaxLG3Frames: integer;
  1175.         VideoRateAveraging: boolean;
  1176.         VideoControl: DialogPtr;
  1177.         ConstantReg: ptr;
  1178.         ScaleHighReg, ScaleLowReg: IntegerPtr;
  1179.         AG5LutMode: boolean;
  1180.         AG5GrabMode: (GrabNormal, GrabSum, GrabDivide, GrabScale);
  1181.         AG5BufferMode: (Read0Lut0Grab0, Read1Lut0Grab0, Read2Lut0Grab0, Read3Lut0Grab0, Read0Lut1Grab0, Read1Lut1Grab0, Read2Lut1Grab0, Read3Lut1Grab0,{}
  1182.             Read0Lut0Grab1, Read1Lut0Grab1, Read2Lut0Grab1, Read3Lut0Grab1, Read0Lut1Grab1, Read1Lut1Grab1, Read2Lut1Grab1, Read3Lut1Grab1);
  1183.         SyncMode: SyncModeType;
  1184.         DitherColor: boolean;
  1185.         RGBLut: (ExistingLUT, SystemLUT, CustomLUT);
  1186.         Highlight1, Highlight254: rgbColor;
  1187.         HighlightMode: boolean;
  1188.         OpeningPlugInWindow: boolean;
  1189.         DacAReg, DacBReg: ptr;
  1190.         LG3DacA, LG3DacB, LG3DataOut: integer;
  1191.         nAcqPlugIns, nExportPlugIns, nFilterPlugIns: integer;
  1192.         LastAcqPlugIn, LastFilterPlugIn, LastExportPlugIn, NewTitle: string[31];
  1193.         TextInfo: TextInfoPtr;
  1194.         nTextWindows: integer;
  1195.         TextWindow: array[1..MaxTextWindows] of WindowPtr;
  1196.         SearchString: string[31];
  1197.         CurrentWPtr: WindowPtr;
  1198.         CurrentKind: integer;
  1199.         ToolBits: BitMap;
  1200.         TextCreator: packed array[1..4] of char;
  1201.         CurrentMathOp: (AddMath, SubMath, MulMath, DivMath, AndMath, OrMath, XorMath, MaxMath, MinMath, cMulMath, CopyMath);
  1202.         MathSrc1, MathSrc2: integer;
  1203.         MathGain, MathSubGain: extended;
  1204.         MathOffset, MathSubOffset: extended;
  1205.         MathResult: string[31];
  1206.         APReset: boolean;
  1207.         ShowPlot: boolean;
  1208.         osGDevice: GDHandle;
  1209.         gCopyMode: integer;
  1210.         SaveScreenDepth: integer;
  1211.         FiducialMethod: FiducialMethodType;
  1212.         ConfirmFidClicks: boolean;
  1213.         WireframeSurfacePlots, GrayscaleSurfacePlots: boolean;
  1214.         RankFilter: (MedianRank, MinRank, MaxRank, OpeningRank, ClosingRank);
  1215.         RankIterations: integer;eVar:eType;
  1216.         TextScrollActionProc:UniversalProcPtr;{ControlActionUPP} {ppc-bug}
  1217.         AboutBoxFilterProc, AboutBoxUserProc, ResultsScrollActionProc, ImageMathUserProc, SetScaleUserProc:UniversalProcPtr;
  1218.         OpenDHookProc, SaveAsDHookProc, ImportDHookProc, ExportDHookProc:UniversalProcPtr;
  1219.         BitInfoProc, GetPictDataProc:UniversalProcPtr;
  1220.         TestAbortProc, UpdateProgressProc:UniversalProcPtr;
  1221.         IntegrateOnChip: boolean;
  1222.         OpeningFinderFiles:boolean;
  1223.         gNumberSlices, gBorders: boolean;
  1224.         RealImageMath:boolean;
  1225.         StartupSpec: FSSpec;
  1226.         DicomInitialized, ImportingDicom:boolean;
  1227.         OpeningRGB: boolean;
  1228.         superSlotBase: LongInt; {address of frame buffer using 32-bit addressing}
  1229.         PrecisionTiming, TimeStamp, LG3BufferCapture: boolean;
  1230.         SecondsPerFrame: extended;
  1231.         TriggerFirstFrameOnly: boolean;
  1232.         UseExistingStack: boolean;
  1233.         RealArithmetic: boolean;
  1234.         vdig: ComponentInstance;
  1235.         GWorldLUT: CTabHandle;
  1236.         osGWorld: GWorldPtr;
  1237.         UseBuiltinDigitizer: boolean;
  1238.         DigitizerMode: VideoDigitizerMode;
  1239.         DigitizerStandard: VideoDigitizerStandard;
  1240.         fgSuperSlotBase0, fgSuperSlotBase1: LongInt;
  1241.         PCIFrameGrabber, DoubleBuffering, CurrentBufferIsZero: boolean;
  1242.         LUTFriendlyMode: boolean;
  1243.         MovieToolboxInitialized: boolean;
  1244.     
  1245.  
  1246. implementation
  1247.  
  1248. end.